Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

nice_things/path/dir_name.sh

dir_name

Since 0.3.0 · Source

import "{ dir_name }" from nice_things/path/dir_name.sh

Synopsis
dir_name <out_var> <pathname>

Configuration

Description
Get the directory portion of <pathname>, with the last component removed.

The result is similar to the dirname utility specified in POSIX.

Options

Operands

  • <out_var>: Output variable; the result will be written to this variable.
  • <pathname>: A path name.

Stdin

Stdout

Stderr

Exit status
0: Successful completion.

Abort

Usage examples

# Get directory of current program
dir_name program_dir "$0"